<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.org/ui"
                xmlns:poue="http://primefaces.org/ui/extensions">


    <ui:define name="content">

        <h:panelGroup >
            <h:form id="form"  >
                <p:growl autoUpdate="true" />
                <p:panel id="panIx"  >

                    <f:facet name="header" >
                        <h:outputLabel value="List of All Investigations"></h:outputLabel>
                        <p:commandButton ajax="false" value="Refresh" action="#{investigationController.listAllIxs}" styleClass="noPrintButton" onclick="onSubmitButton();"  />
                        <p:commandButton ajax="false" value="Print" styleClass="noPrintButton" >
                            <p:printer target="panIx" />
                        </p:commandButton>
                        <p:commandButton id="excel" ajax="false" value="Excel"  >
                            <p:dataExporter target="tbl" type="csv" fileName="List of All Investigations"  />
                        </p:commandButton>
                    </f:facet>
                    <p:dataTable id="tbl" rowIndexVar="rowIndex" value="#{investigationController.allIxs}" var="ix" 
                                 rows="20"
                                 paginator="true"
                                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                                 rowsPerPageTemplate="20, 50, 100" 
                                 >
                        <p:column headerText="No." width="30">
                            <h:outputLabel value="#{rowIndex + 1}" ></h:outputLabel>
                        </p:column>  
                        <p:column headerText="Investigation" sortBy="#{ix.name}" filterBy="#{ix.name}" filterMatchMode="contains">
                            <h:outputLabel value="#{ix.name}" ></h:outputLabel>
                        </p:column>
                        <p:column headerText="Category" >
                            <h:outputLabel value="#{ix.category.name}" ></h:outputLabel>
                        </p:column>
                        <p:column headerText="Institution" sortBy="#{ix.institution.name}" filterBy="#{ix.institution.name}" filterMatchMode="contains">
                            <h:outputLabel value="#{ix.institution.name}" ></h:outputLabel>
                        </p:column>
                        <p:column headerText="Department" sortBy="#{ix.department.name}" filterBy="#{ix.department.name}" filterMatchMode="contains">
                            <h:outputLabel value="#{ix.department.name}" ></h:outputLabel>
                        </p:column>
                        <p:column headerText="Price" sortBy="#{ix.total}" width="200" style="text-align: right; padding-right: 20px;">
                            <h:outputLabel value="#{ix.total}" >
                                <f:convertNumber pattern="#,##0.00" ></f:convertNumber>
                            </h:outputLabel>
                        </p:column>
                    </p:dataTable>
                </p:panel>
            </h:form>
        </h:panelGroup>

        <h:form>




        </h:form>


    </ui:define>

</ui:composition>
